f = open('writelines.txt','w')

lines = []
for i in range(10):
    lines.append(str(i))

f.writelines(lines)